Skip to content

Conversation

@jcolladokuri
Copy link
Contributor

@jcolladokuri jcolladokuri commented Nov 14, 2025

This PR moves the health check to backend only leaving in the frontend the functionality to test the dbconnector datasource.

Leaving the dbconnector.testDataSource should be fine since the datasource types we allow for db connection with Zabbix already are backend datasources, and so their health requests would go through the backend.

Verified:
Clicking test and seeing a health request go out.

IMPORTANT: While testing this in the UI, I found a bug with the config editor - whenever a change is made in the UI and tested, the changes don't take effect (i.e. disabling trends, keeps trends set to true, enabling db connection keep dbConnectionEnabled set to false and so on.). Created a separate issue to fix this

Fixes https://github.com/grafana/oss-big-tent-squad/issues/124
Fixes #2004

@jcolladokuri jcolladokuri requested a review from a team as a code owner November 14, 2025 22:02
*/
async testDatasource() {
const backendDS = new DataSourceWithBackend(this.instanceSettings);
try {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

For this, I am using this approach for now, but it should be temporary, I have a separate issue to track migrating from DatasourceApi to DatasourceWithBackend when this is complete we will no longer need to have this here.

Copy link
Contributor

@itsmylife itsmylife left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It looks good but we need to double check if we still need testDatasource()

/**
* Test connection to Zabbix API and external history DB.
*/
async testDatasource() {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Do we still need this method? I think this is needed for frontend implementation. Now the config editor must have called backend CheckHealth endpoint out of the box.

Copy link
Contributor Author

@jcolladokuri jcolladokuri Nov 18, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I thought we still needed it. Maybe once we migrate to DatasourceWithBackend (in progress) we don't, but even then, for this scenario we will still need it, because the part that tests the DB connection cannot be moved to the backend, in the frontend we call those datasource's "testDatasource" and they call their backend, and so here we merge the results from both.

I also checked a few other datasources and can see that they are still using the testDatasource method, for example: jaeger and tempo

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

They were frontend only data sources and migrated to backend. Actually I raised that question in some other place too. In prometheus we don't use it. Do you mind checking what happens when we remove that method?

@zoltanbedi zoltanbedi changed the title Move health check to the backed Move health check to the backend Nov 20, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

Status: No status

Development

Successfully merging this pull request may close these issues.

Standardize in the backend health check for the Zabbix datasource

3 participants